<extend name="Public:layout"/>
<block name="css">
    <link rel="stylesheet" href="__STATIC__/plugin/wangEditor/css/wangEditor.min.css">
</block>

<block name="js">
    <!--<script src="__STATIC__/plugin/wangEditor/js/wangEditor.min.js"></script>-->
    <!--<script src="__STATIC__/plugin/wangEditor/js/plugin.js"></script>-->
    <script type="text/javascript">
        var QINIU = $.parseJSON('{$qiniu|json_encode}');

        var saveto ='qiniu';   //储存位置为七牛云，对应于插件里的判断值
        var qiniu_uptoken=QINIU.token;  //七牛云服务端生成的uptoken
        var qiniu_upload_domain='http://upload.qiniu.com';   //七牛云上传地址，一般无需修改，https需要修改成对应的七牛云https上传域名
        var qiniu_bucket_domain=QINIU.domain;   //七牛云bucket设置的域名
    </script>
    <script src="__STATIC__/plugin/plupload/plupload.full.min.js"></script>
    <script src="__STATIC__/plugin/qiniu.min.js"></script>
    <script src="__STATIC__/plugin/ckeditor/ckeditor.js"></script>
</block>
<block name="content">
    <div class="panel admin-panel">
        <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>编辑文章</strong></div>
        <div style="height:30px;"></div>
        <div class="container-fluid">
            <form method="post" class="form-x ajax-submit" action="{:U('edit')}">
                <input type="hidden" name="article_id" value="{$info.article_id}">
                <div class="row">
                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">标题</div>
                            <input type="text" class="form-control" value="{$info.title}" name="title" placeholder="请输入标题" data-validate="required:请输入标题">
                        </div>
                    </div>


                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">作者</div>
                            <input type="text" class="form-control" value="{$info.author|default=$user['user_name']}" name="author" placeholder="请输入作者" data-validate="required:请输入作者">
                        </div>
                    </div>

                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">来源</div>
                            <input type="text" class="form-control" value="{$info.source}" name="source" placeholder="请输入来源" data-validate="required:请输入来源">
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">关键词</div>
                            <input type="text" class="form-control" value="{$info.keyword|default=$website_info['seo_keywords']}" name="keyword" placeholder="请输入关键词" data-validate="required:请输入关键词">
                        </div>
                    </div>

                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">视频链接</div>
                            <input type="text" class="form-control" value="{$info.video_url}" name="video_url" placeholder="请输入视频链接">
                        </div>
                    </div>

                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">来源链接</div>
                            <input type="text" class="form-control" value="{$info.website}" name="website" placeholder="请输入来源链接" data-validate="required:请输入来源链接">
                        </div>
                    </div>
                </div>


                <div class="row">
                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">描述</div>
                            <textarea type="text" class="form-control" name="description" placeholder="请输入描述" data-validate="required:请输入描述">{$info.description|default=$website_info['seo_description']}</textarea>
                        </div>
                    </div>

                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">状态</div>
                            <select name="status" class="form-control">
                                <option value="1">启用</option>
                                <option value="0" <?php if($info['status'] === '0') echo "selected"?> >禁用</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">日期</div>
                            <input type="text" id="time" class="form-control" name="create_time" value="{$info.create_time|default=time()|sp_date}">
                        </div>
                    </div>

                    <!--<div class="form-group col-lg-4 col-md-4">-->
                        <!--<div class="input-group">-->
                            <!--<div class="input-group-addon">排序</div>-->
                            <!--<input type="text" class="form-control" value="{$info.sort}" name="sort" placeholder="1 - 99 从小到大排序">-->
                        <!--</div>-->
                    <!--</div>-->
                </div>

                <div class="row">


                    <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">分类</div>
                            <select multiple name="category_id[]" class="form-control">
                                <foreach name="category" item="vo" key="k">
                                    <option value="{$k}" <?php if(in_array($k, $attr['category'])) echo 'selected'?>>{$vo}</option>
                                </foreach>
                            </select>
                        </div>
                    </div>

                   <!-- <div class="form-group col-lg-4 col-md-4">
                        <div class="input-group">
                            <div class="input-group-addon">站点</div>
                            <select multiple name="website_id[]" class="form-control">
                                <foreach name="website" item="vo" key="k">
                                    <option value="{$k}" <?php if(in_array($k, $attr['website'])) echo 'selected'?>>{$vo}</option>
                                </foreach>
                            </select>
                        </div>
                    </div>-->

                </div>
                <div class="row">
                    <div class="col-lg-12 col-md-12">
                        <div class="col-lg-1 col-md-1">缩略图</div>
                        <div class="col-lg-10 col-md-10">
                            <button type="button" class="btn btn-primary upload">上传图片</button>
                            <button type="button" class="btn btn-info show-upload" data-ext="image" data-input="input[name=thumb]" data-preview=".preview-upload">已上传的图片</button>
                            <span class="text-info">请上传640*360的图片</span>
                            <input type="hidden" name="thumb" value="{$info.thumb}"/>
                            <img src="{$info.thumb}" class="preview-upload" alt="" style="width:640px;height:360px;background:#CCCCCC;display:block">
                        </div>
                    </div>

                </div>
                <div class="row">
                    <div class="col-lg-12 col-md-12">
                        <textarea name="content" id="article-content" style="width:100%;height:500px;">{$info.content}</textarea>
                    </div>
                </div>
                    
                
                <div class="form-group">
                    <div class="label">
                        <label></label>
                    </div>
                    <div class="field">
                        <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
                    </div>
                </div>


            </form>
        </div>
    </div>
</block>